from __future__ import with_statement
import win32clipboard as w 
import win32con
import os

def getText(): 
    w.OpenClipboard() 
    d=w.GetClipboardData(win32con.CF_TEXT) 
    w.CloseClipboard() 
    return d 
 
def setText(aString): 
    w.OpenClipboard()
    w.EmptyClipboard()
    w.SetClipboardData(win32con.CF_TEXT,aString) 
    w.CloseClipboard()

tmpnam = 'd:/tmp/sliptemp.txt'

with open(tmpnam, 'w') as f:
	f.write(getText())

import slide
slide.openFile(tmpnam)

out = slide.objCurrDocInstance.SLIP
out = [l for l in out.expandtabs(4).splitlines() if l.strip()]
o =  '\n'.join(out)
print o

with open(tmpnam, 'w') as f:
	f.write(o)

os.startfile(tmpnam)


